﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.hive;

namespace SharpSqlAnalyzer.stmt.hive
{
	// Token: 0x020001BF RID: 447
	public class THiveGrant : TCustomSqlStatement
	{
		// Token: 0x06000EDE RID: 3806 RVA: 0x0030AB39 File Offset: 0x00308D39
		public THiveGrant(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.ssthiveGrant;
		}

		// Token: 0x170002B6 RID: 694
		// (get) Token: 0x06000EDF RID: 3807 RVA: 0x0030AB4D File Offset: 0x00308D4D
		// (set) Token: 0x06000EE0 RID: 3808 RVA: 0x0030AB55 File Offset: 0x00308D55
		public virtual List<THivePrincipalName> Principals
		{
			get
			{
				return this.principals;
			}
			set
			{
				this.principals = value;
			}
		}

		// Token: 0x170002B7 RID: 695
		// (get) Token: 0x06000EE1 RID: 3809 RVA: 0x0030AB5E File Offset: 0x00308D5E
		// (set) Token: 0x06000EE2 RID: 3810 RVA: 0x0030AB66 File Offset: 0x00308D66
		public virtual List<THivePrivilegeDef> PrivilegeList
		{
			get
			{
				return this.privilegeList;
			}
			set
			{
				this.privilegeList = value;
			}
		}

		// Token: 0x170002B8 RID: 696
		// (get) Token: 0x06000EE3 RID: 3811 RVA: 0x0030AB6F File Offset: 0x00308D6F
		// (set) Token: 0x06000EE4 RID: 3812 RVA: 0x0030AB77 File Offset: 0x00308D77
		public virtual bool WithOption
		{
			get
			{
				return this.withOption;
			}
			set
			{
				this.withOption = value;
			}
		}

		// Token: 0x170002B9 RID: 697
		// (get) Token: 0x06000EE5 RID: 3813 RVA: 0x0030AB80 File Offset: 0x00308D80
		// (set) Token: 0x06000EE6 RID: 3814 RVA: 0x0030AB88 File Offset: 0x00308D88
		public virtual TTable Table
		{
			get
			{
				return this.table;
			}
			set
			{
				this.table = value;
			}
		}

		// Token: 0x170002BA RID: 698
		// (get) Token: 0x06000EE7 RID: 3815 RVA: 0x0030AB91 File Offset: 0x00308D91
		public virtual TSourceToken TableToken
		{
			get
			{
				return this.tableToken;
			}
		}

		// Token: 0x06000EE8 RID: 3816 RVA: 0x0030AB9C File Offset: 0x00308D9C
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			THiveGrantSqlNode thiveGrantSqlNode = (THiveGrantSqlNode)this.rootNode;
			this.table = this.analyzeFromTable(thiveGrantSqlNode.FromTable, new bool?(true));
			this.principals = thiveGrantSqlNode.Principals;
			this.privilegeList = thiveGrantSqlNode.PrivilegeList;
			this.withOption = thiveGrantSqlNode.WithOption;
			this.tableToken = thiveGrantSqlNode.TableToken;
			return 0;
		}

		// Token: 0x06000EE9 RID: 3817 RVA: 0x0030AC10 File Offset: 0x00308E10
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000EEA RID: 3818 RVA: 0x0030AC20 File Offset: 0x00308E20
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.principals != null)
			{
				foreach (THivePrincipalName thivePrincipalName in this.principals)
				{
					thivePrincipalName.acceptChildren(v);
				}
			}
			if (this.privilegeList != null)
			{
				foreach (THivePrivilegeDef thivePrivilegeDef in this.privilegeList)
				{
					thivePrivilegeDef.acceptChildren(v);
				}
			}
			v.postVisit(this);
		}

		// Token: 0x04001348 RID: 4936
		private List<THivePrincipalName> principals;

		// Token: 0x04001349 RID: 4937
		private List<THivePrivilegeDef> privilegeList;

		// Token: 0x0400134A RID: 4938
		private bool withOption;

		// Token: 0x0400134B RID: 4939
		private TTable table;

		// Token: 0x0400134C RID: 4940
		private TSourceToken tableToken;
	}
}
